package com.kejiguan.ui.dialog;

import android.content.Context;

import com.kejiguan.ui.R;
import com.kejiguan.ui.model.Shedule;

/**
 * Created by apple on 16/5/13.
 */
public class ModifySheduleDialogUtil {

    private static ModifySheduleDialogUtil instance;
    private ModifySheduleDialog modifySheduleDialog;

    public ModifySheduleDialogUtil() {
    }

    public static ModifySheduleDialogUtil getInstance() {
        if (instance == null) {
            synchronized (ModifySheduleDialogUtil.class) {
                if (instance == null) {
                    instance = new ModifySheduleDialogUtil();
                }
            }
        }
        return instance;
    }

    public void show(Context context, ModifySheduleDialog.ModifySheduleListerner modifySheduleListerner, Shedule preShedule)
    {
        if (null == modifySheduleDialog || !modifySheduleDialog.isShowing())
        {
            modifySheduleDialog = new ModifySheduleDialog(context, R.style.dialog_tran);
        }
        modifySheduleDialog.setModifySheduleListerner(modifySheduleListerner);
        modifySheduleDialog.setPreShedule(preShedule);
        modifySheduleDialog.show();
        modifySheduleDialog.setCanceledOnTouchOutside(true);
    }

    public void dismiss() {
        if (null != modifySheduleDialog && modifySheduleDialog.isShowing()) {
            modifySheduleDialog.dismiss();
        }

    }

}
